import request from '@/utils/request.js'

/**
 * 获取所有频道列表数据
 * @returns promise
 *  return 作用：因为request为promise  await修饰的promise 不 return的话，
 * 返回的是undefined,只有return 返回的才是promise
 */
export const getAllChannels = () => {
  return request({
    url: '/v1_0/channels',
    method: 'GET'
  })
}
/**
 *新增频道
 * @param {*} channel {id,seq}
 * @returns promis
 */
export const addUserChannel = channel => {
  return request({
    url: '/v1_0/user/channels',
    method: 'PATCH', // 更新数据
    data: {
      channels: [channel]
    }
  })
}
export const deleteUserChannel = id => {
  return request({
    url: '/v1_0/user/channels/' + id,
    method: 'DELETE'
  })
}
